<%-- 
    Document   : loginForm
    Created on : Feb 6, 2018, 9:32:40 PM
    Author     : james
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page language="java" %>
<%@taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> Login Page</title>
    </head>
    <body>

        <table border="1">
            <form action="loginAction" method="POST">
                <tr> 
                    <td>Your&nbsp;&nbsp;Name: </td> 
                    <td>
                        <!-- name="username" define the key of request parameters -->
                        <input type="text" name="username"/>
                    </td> 
                </tr>
                <tr> 
                    <td>Your&nbsp;&nbsp;Password: </td> 
                    <td> <input type="password" name="password"/></td>
                </tr>
                <tr> 
                    <td>
                        <input type="submit" value="Log IN" 
                               onclick="this.form.action='loginAction';" />
                    </td>
                    <td>
                        <input type="submit" value="Regist" 
                               onclick="regist();"/>
                    </td>
                </tr>
            </form>
        </table>
        
        <script type="text/javascript">
            function regist() {
                // Acheive Page's first form;
                targetForm = document.forms[0];
                // Dynamic modify form's acion abbtribute
                targetForm.action = "registAction";
            }
        </script>
    </body>
</html>
